package edu.fpa.day0801;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class TestDate {
    public static void main(String [] args){
//        Calendar a1=new GregorianCalendar(2021,8,1,10,7,33);
//        int A=a1.get(Calendar.YEAR);
//        System.out.println(A);
//        //获取
//
//
//        a1.add(Calendar.MONTH,2);
//        System.out.println(a1);
//        //加
//
//        a1.set(Calendar.YEAR,2020);
//        System.out.println(a1);
        Calendar c1=new GregorianCalendar(2021,8,1,10,28,33);

        Set(c1);

    }
    public static void Set(Calendar x){
        int year=x.get(Calendar.YEAR);
        int month=x.get(Calendar.MONTH)+1;//0--11
        int date=x.get(Calendar.DAY_OF_MONTH);
        int hour=x.get(Calendar.HOUR);
        int minute=x.get(Calendar.MINUTE);
        int second=x.get(Calendar.SECOND);
        int week=x.get(Calendar.DAY_OF_WEEK)-1;//1-7,1--week7,2--week1
        String week2=(week==0)?"日":week+"";
        System.out.println(year+"年"+month+"月"+date+"日"+hour+"时"+minute+"分"+second+"秒"+"周"+week2);
    }
}
